(in-package #:test.org.apache.zookeeper.audit)

(defclass AuditEventTest ()
  ())

(test my-test
  (is (= 2 (+ 1 1))))

(test testFormat
  (let* ((auditEvent (make-instance 'AuditEvent :result :SUCCESS))
	 (c (addEntry auditEvent :USER "Value1"))
	 (m (addEntry auditEvent :OPERATION "Value2"))
	 (actual (toString auditEvent))
	 (expected "user=Value1\toperation=Value2\tresult=success"))
    (is (string-equal expected actual))))


(test testFormatShouldIgnoreKeyIfValueIsNull
  (let* ((auditEvent (make-instance 'AuditEvent :result :SUCCESS))
	 (c (addEntry auditEvent :USER nil))
	 (m (addEntry auditEvent :OPERATION "Value2"))
	 (actual (toString auditEvent))
	 (expected "operation=Value2\tresult=success"))
    (is (string-equal expected actual))))

;; done
